#include "StdAfx.h"
#include "Job.h"

Job::Job(const vector<float> tempsOP, const unsigned ID ):_ID(ID), _tempsOP(tempsOP){

}

Job::~Job(void){

}

unsigned Job::GetNbMachines()const{
	return _tempsOP.size();
}
unsigned Job::GetID() const{
	return _ID;
}

float Job::TempsOp(const unsigned numMi) const{
	if (numMi >= _tempsOP.size()) 
		throw exception ("Cette Machine n'existe pas");

	return _tempsOP.at(numMi);
}

std::ostream & operator<<(std::ostream & flot,const Job & j){
	flot << "JOB " << j.GetID() << endl;
	for(unsigned i = 0 ; i < j.GetNbMachines() ; i++){
		flot << "M" << i+1 << "=" << j.TempsOp(i) <<"\t";
	}
	flot << endl;
	return flot;
}
